﻿using System;
using System.Windows.Forms;
using System.IO;
using MediaController.Client.DAL;

namespace MediaController.Client.Controls.Dialogs
{
    public partial class SelectFolderDlg : Form
    {
       public string Path
        {
            get { return _textBoxSource.Text; }
            set { _textBoxSource.Text = value; }
        }

        public SelectFolderDlg()
        {
            InitializeComponent();
             
        }

        private void ButtonBrowesClick(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(_textBoxSource.Text))
                _folderBrowserDialog.SelectedPath = _textBoxSource.Text;

            if (_folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                _textBoxSource.Text = _folderBrowserDialog.SelectedPath;
            }
        }
      
        private void ButtonOkClick(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Path))
            {
                MessageBox.Show(string.Format("You must souce directory"));
            }
            else if (!Directory.Exists(Path))
            {
                MessageBox.Show(string.Format("Cannot find directory {0}", Path));
            }
            else
            {
            }
        }

    }
}
